#ifndef NETWORKWINDOW_H
#define NETWORKWINDOW_H

#include <QWidget>
#include <QHostInfo>
#include <QHostAddress>
#include <QTcpServer>   //监听套接字
#include <QTcpSocket>   //通信套接字
#include <QUdpSocket>   //UDP套接字
#include <QJsonObject>
#include <QJsonDocument>
#include <QJsonArray>


namespace Ui {
class NetWorkWindow;
}

class NetWorkWindow : public QWidget
{
    Q_OBJECT

public:
    explicit NetWorkWindow(QWidget *parent = 0);
    ~NetWorkWindow();

    void initIPAddress();
    QByteArray packJson();
    void parseJson(QByteArray text);

    QTcpServer *s_socket;
    QTcpSocket *c_socket;
    QTcpSocket *client_socket;
    QUdpSocket *u_socket;
    QJsonObject root;

private slots:
    void on_pushButton_clicked();

    void on_sendPushButton_clicked();

    void on_clearTxtButton_clicked();

private:
    Ui::NetWorkWindow *ui;
};

#endif // NETWORKWINDOW_H
